package com.bigdata.bookinfo.mapper;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class PressBookNumMapper extends Mapper<LongWritable, Text, Text, IntWritable> {
    @Override
    protected void map(LongWritable key, Text value, Context context) throws InterruptedException, IOException {
        String[] line = value.toString().split("\t");
        String press = line[5];
        if (press.contains("出版社")||press.contains("公司")||press.contains("出版总社")||press.contains("学校"))
            context.write(new Text(press),new IntWritable(1));
    }
}
